{* $Id$ *}
{include_core file="admin/lib/header.html" title="终端设备展示"}
  <div class="page-header border-bottom clearfix">
    <h2 class="left">终端管理<span>在这里对终端设备进行管理</span></h2>
  </div>

  <div class="search-level1 clearfix" {if $is_advenced == 1}style="display:none;"{/if}>
    <form action="machine/admin/device" method="get">
      <input type="hidden" name="is_advenced" value="0">
      <input type="hidden" name="status" value="{$status}">
      <input type="text" class="left" name="search_filter[device_no]" value="{$search_filter.device_no}" placeholder="序列号">
      <button type="submit" class="btn btn-success btn-sm left">搜索</button>
    </form>
  </div>

  <div class="search-form js_advancedForm" {if $is_advenced == 0}style="display:none;"{/if}>
    <form action="machine/admin/device" method="get" class="js_focusSearchForm">
      <input type="hidden" name="is_advenced" value="1">
      <input type="hidden" name="status" value="{$status}">

      <p>
      <label for="" class="search-f-label">添加时间：</label>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[start_date]" value="{$search_filter.start_date}" id="startDate">
        <span class="search-f-line"></span>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[end_date]" value="{$search_filter.end_date}" id="stopDate">
      </p>
      <p><label for="" class="search-f-label"></label><button type="submit" class="btn btn-success btn-xs js_searchBtn">搜索</button></p>
    </form>
  </div>

  <!--start:列表-->
  <table class="list-table">
    <caption>按类型：
    {foreach machine_config::$res_name_str_list as $k=>$v}
      <a href='{AnUrl("machine/admin/device?res_name=$k")}' {if $res_name == $k} class="label label-primary" {else} class="label label-default" {/if}>{$v}</a>
    {/foreach}
    <br/><br/>按状态：
      <a href='{AnUrl("machine/admin?status=-1&res_name=$res_name")}' {if $status == -1} class="label label-primary" {else} class="label label-default" {/if}>全部</a>
      <a href='{AnUrl("machine/admin?status=0&res_name=$res_name")}' {if $status == 0} class="label label-primary" {else} class="label label-default" {/if}>未激活</a>
      <a href='{AnUrl("machine/admin?status=1&res_name=$res_name")}' {if $status == 1} class="label label-primary" {else} class="label label-default" {/if}>待激活</a>
      <a href='{AnUrl("machine/admin?status=2&res_name=$res_name")}' {if $status == 2} class="label label-primary" {else} class="label label-default" {/if}>已绑定</a>
    </caption>
    <thead><tr>
      <th style="width:60px;">序列号</th>
      <th style="width:60px;">状态</th>
      <th style="width:60px;">操作</th>
    </tr></thead>
    <tbody>
      {foreach $device_list as $k=>$v}
        <tr id="dataList{$v.id}" {if $k%2 == 1} class="bg-gray"{/if} data-id="{$v.id}">
          <td>{$v.device_no}</td>
          <td>
            {if $v.status == 0}
              <a href="javascript:void(0);" class="btn  btn-primary btn-xs "><i class="icon-trash icon-white"></i>未激活</a>
            {elseif $v.status == 1}
              <a href="javascript:void(0);" class="btn  btn-warning btn-xs "><i class="icon-trash icon-white"></i>待激活</a>
            {elseif $v.status == 2}
              <a href="javascript:void(0);" class="btn  btn-success btn-xs "><i class="icon-trash icon-white"></i>已绑定</a>
            {elseif $v.status == 3}
              <a href="javascript:void(0);" class="btn  btn-danger btn-xs "><i class="icon-trash icon-white"></i>停用</a>
            {/if}
          </td>
          <td><a href="{AnUrl("machine/admin/get_device_no_record?id={$v.id}&device_no={$v.machine_no}&res_name=machine")}" class="btn btn-info btn-xs js_storeDeviceRecord"><i class="icon-trash icon-white"></i>查看序列号绑定记录</a></td>
            
        </tr>
      {foreachelse}
          <tr><td class="txtleft" colspan="6">暂无数据</td></tr>
      {/foreach}
    </tbody>
  </table>
  <script type="text/javascript">
  $(function(){
    // 高级搜索
    $('.js_advanced').click(function(e){
      e.preventDefault();
      var thisObj = $(this);
      var outBox  = thisObj.closest('form');
      if (thisObj.hasClass('js_isOpen')) {
        thisObj.removeClass('js_isOpen open');
        outBox.find('input').show();
        outBox.find('button').show();
        $('.js_advancedForm').hide();
      } else {
        thisObj.addClass('js_isOpen open');
        outBox.find('input').hide();
        outBox.find('button').hide();
        $('.js_advancedForm').show();
      }
    });

  });
  </script>
  {include_core file="admin/lib/pager.html"}
<!--end:列表-->
{load_js file='zclip/jquery.zclip.min.js'}
{load_js file='zclip/ZeroClipboard.js'}
{include_core file="admin/lib/footer.html"}